const CracoLessPlugin = require('craco-less');
const path = require("path");

module.exports = {
    devServer:{
        proxy:{
            "/admin":{
                target:"http://121.89.205.189:3000",
                changeOrigin:true,
            }
        }
    },
    // 支持less
    plugins: [
        {
            plugin: CracoLessPlugin,
            options: {
                lessLoaderOptions: {
                    lessOptions: {
                        modifyVars: { '@primary-color': '#ff4500' },
                        javascriptEnabled: true,
                    },
                },
            },
        },
    ],
    babel: {
        plugins: [
            // 装饰器
            ["@babel/plugin-proposal-decorators", { legacy: true }],
            // antd按需加载
            [
                "import",
                {
                    "libraryName": "antd",
                    "libraryDirectory": "es",
                    "style": true
                }
            ]
        ]
    },
    webpack: {
        // 起别名
        alias: {
            '@': path.resolve(__dirname, "./src"),
            '@utils': path.resolve(__dirname, "./src/utils"),
        }
    }
}